/* Check JER_Erasures_To_Erased(). */
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include "reed_sol-2.h"
#include "jerasure-2.h"
#include "galois-2.h"

using namespace std;

int main( int argc, char** argv )
{
	JER_Bitmatrix *jbm;
	JER_Matrix *jm2;
	JER_Slices *slices;
	int i, j;

	int m = atoi( argv[1] );
	int k = atoi( argv[2] );
	int w = atoi( argv[3] );
	int tmp;
	unsigned char* buffer;
	int size;
	vector <int> erasures;
	vector <int> erased;

	srand48(m);
	for( i = 0; i < m; i++ )
	{
		tmp = lrand48() % (k+m);
		for( j = 0; j < erasures.size() && erasures[j] != tmp; j++ );
		if( j == erasures.size() )
			erasures.push_back( tmp );
	}

	JER_Erasures_To_Erased( k, m, erasures, erased );

	for( i = 0; i < k+m; i++ )
		fprintf( stdout, "%u ", erased[i] );
	fprintf( stdout, "\n" );
	return 0;
}
